/**
 * 
 */
package dgdb2d;

import java.net.InetSocketAddress;
import java.rmi.Remote;
import java.rmi.RemoteException;

import com.tinkerpop.blueprints.pgm.Edge;
import com.tinkerpop.blueprints.pgm.Vertex;

import java.util.HashSet;

public interface RemoteGraph extends Remote {
	/** Nalozenie blokady na indeks przechowujacy informacje o wierzcholkach */
	void lockRemoteVertexIndex() throws RemoteException;
	/** Zdjecie blokady z indeksu przechowujacego informacje o wierzcholkach */
	void unlockRemoteVertexIndex() throws RemoteException;
	/** Nalozenie blokady na indeks przechowujacy informacje o krawedziach */
	void lockRemoteEdgeIndex() throws RemoteException;
	/** Zdjecie blokady z indeksu przechowujacego informacje o krawedziach */
	void unlockRemoteEdgeIndex() throws RemoteException;
	/** Zapisanie elementu do pliku */
	void saveRemoteElement(GDBElement element) throws RemoteException;
	/** Dodanie informacji o elemencie do indeksu */
	void addRemoteElement(GDBElement element, PairIp ipNums) throws RemoteException;
	/** Usuniecie informacji o elemencie z indeksu */
	void removeRemoteElementFromLocalIndex(GDBElement element) throws RemoteException;
	/** Usuniecie pliku z elementem */
	void deleteRemoteElement(GDBElement element) throws RemoteException;
	Vertex addRemoteVertex(Object id) throws RemoteException;

	Vertex getRemoteVertex(Object id) throws RemoteException;

	Iterable<Vertex> getRemoteVertices() throws RemoteException;

	void removeRemoteVertex(Vertex vertex) throws RemoteException;

	Edge addRemoteEdge(Object id, Vertex outVertex, Vertex inVertex, String label) throws RemoteException;
	
	Edge getRemoteEdge(Object id) throws RemoteException;
	
	Iterable<Edge> getRemoteEdges() throws RemoteException;

	void removeRemoteEdge(Edge edge) throws RemoteException;

	void clearRemote() throws RemoteException;

	void shutdownRemote() throws RemoteException;

	HashSet<InetSocketAddress> getRemoteServerSet() throws RemoteException;

	void hereIAm(InetSocketAddress address) throws RemoteException;
	
	void eraseAddressFromServermap(InetSocketAddress address) throws RemoteException;
	
	InetSocketAddress getIp() throws RemoteException;

	public Iterable<Edge> getRemoteVertexInEdges(Object id, String[] labels) throws RemoteException;
	public Iterable<Edge> getRemoteVertexOutEdges(Object id, String[] labels) throws RemoteException;
	
	/** Ustawianie property dla Vertex'a */
	public void setRemoteVertexProperty(Object id, String key, Object value, boolean master) throws RemoteException;
	/** Ustawianie property dla Edge'a */
	public void setRemoteEdgeProperty(Object id, String key, Object value, boolean master) throws RemoteException;
	/** Usuwanie property dla Vertex'a */
	public void removeRemoteVertexProperty(Object id, String key, boolean master) throws RemoteException;
	/** Usuwanie property dla Edge'a */
	public void removeRemoteEdgeProperty(Object id, String key, boolean master) throws RemoteException;
	/** Dodawanie krawedzi wejsciowej do Vertex'a */
	public void addRemoteToVertexInEdge(Object v_id, Object e_id, String label, boolean b) throws RemoteException;
	/** Dodawanie krawedzi wyjsciowej do Vertex'a */
	public void addRemoteToVertexOutEdge(Object v_id, Object e_id, String label, boolean b) throws RemoteException;
	/** Usuwanie krawedzi wejsciowej z Vertex'a */
	public void removeRemoteFromVertexInEdge(Object v_id, Object e_id, boolean b) throws RemoteException;
	/** Usuwanie krawedzi wyjsciowej z Vertex'a */
	public void removeRemoteFromVertexOutEdge(Object v_id, Object e_id, boolean b) throws RemoteException;
	/** Dodawanie nowego backupu Vertex'a*/
	public void createNewVertexBackup(String id) throws RemoteException;
	/** Dodawanie nowego backupu Edge'a*/
	public void createNewEdgeBackup(String id) throws RemoteException;
	/** Uaktualnianie indeksow serwera o podanym ip*/
	public void updateThisServer(InetSocketAddress ip) throws RemoteException;
}
